// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/parking/api/ParkViolationApi'

import TypeClass from '@api/parking/model/ViolationTypeStatPieReq'
import RankClass from '@api/parking/model/ViolationPlateStatRankReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 类型 —————————————————————————————— //

  async getType(param, TIP = '查询违规类型') {
    const DTO = CORE.grpcDTO(TypeClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'violationTypeStatPie', DTO)
    return resp.content || {}
  },

  // —————————————————————————————— 排名 —————————————————————————————— //

  async getRank(param, TIP = '查询累计次数') {
    const DTO = CORE.grpcDTO(RankClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'violationPlateStatRank', DTO)
    return resp.content || []
  },
}
